package com.learn.service;

import com.learn.mapper.UserMapper;
import com.learn.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description: 描述
 * @author: Mr.Hu
 * @create: 2022/3/16 21:30
 **/
@Service
public class UserService {
    @Autowired
    public UserMapper userMapper;
    public User findUserById(int id){
        return userMapper.findUserById(id);
    }
    public User queryByNandP(String userName ,String pwd){
        return userMapper.queryByNAndP(userName,pwd);
    }
    public int insertUser(String userName ,String pwd){
        return userMapper.insertUser(userName,pwd);
    }
    public String checkUser(String userName){
        Integer integer = userMapper.checkUser(userName);
        if (integer==null){
            return null;
        }else {
            return "用户已存在";
        }
    }
    public String queryUserNameById(int userId){
        return userMapper.queryUserNameById(userId);
    }
}
